home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1455 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: northshore.shore.net!not-for-mail
  2. From: dannyw@shore.net (Danny Willis)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: allocating unlimited string input....HELP
  5. Date: 13 Jan 1996 22:36:54 -0500
  6. Organization: Shore.Net/Eco Software, Inc; (info@shore.net)
  7. Message-ID: <4d9tom$og1@northshore.shore.net>
  8. References: <4cvph6$s8s@pulp.ucs.ualberta.ca> <4d0msi$mso@news.gate.net>
  9. NNTP-Posting-Host: northshore.ecosoft.com
  10.  
  11. bhutto@gate.net (William Hutto) writes:
  12.  
  13. >In article <4cvph6$s8s@pulp.ucs.ualberta.ca>,
  14. >   ryangall@gpu.srv.ualberta.ca (Bobby Sixkiller) wrote:
  15. >>I am doing an assignment for my computing class, and seem to have run into 
  16. >>a small problem. I am supposed to be able to read an unlimited string from 
  17. >>stdin, without defining maximum size. I thought that this problem would be 
  18.  
  19. >Small problem? I assume by *read* above, you mean to store. Your teacher must 
  20. >be pulling your leg. If you *ever* write a robust function to achieve the 
  21. >above, let me know. 
  22.  
  23. >Bill
  24.  
  25. You're right: a lot depends on the problem definition here. In particular,\
  26. the simple stdin to stdout copy function at the beginning of K&R would
  27. fit the requirements and do something useful. Alternatively:
  28. while ((c=getc(stdin)!=EOF);
  29. would fit the stated requirments too!
  30. !
  31.